package com.bwie.controller;

import com.bwie.pojo.TbOrder;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/23 16:48
 * @Description:
 **/
@RestController
@RequestMapping("/prod/order")
public class TbOrderController {

    @Autowired
    TbOrderService tbOrderService;

    /**
     * 订单分页
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getOrderPage")
    public R getOrderPage(@RequestBody PageInfoVo pageInfoVo){
        return tbOrderService.getOrderPage(pageInfoVo);
    }

    /**
     * 添加订单
     * @return
     */
    @PostMapping("/getAddOrder")
    public R getAddOrder(@RequestBody List<TbProdInfo> tbProdInfos){
        return tbOrderService.getAddOrder(tbProdInfos);
    }

    /**
     * 批量删除
     * @param tbOrders
     * @return
     */
    @PostMapping("/deleteBatchOrder")
    public R deleteBatchOrder(@RequestBody List<TbOrder> tbOrders){
        return tbOrderService.deleteBatchOrder(tbOrders);
    }

    /**
     * 导出订单列表
     */
    @GetMapping("/getExpartList/{ids}")
    public void getExpartList(@PathVariable("ids") String ids){
        tbOrderService.getExpartList(ids);
    }
}
